package cn.stylefeng.guns.modular.yingbao.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.yingbao.entity.SysSellLog;
import cn.stylefeng.guns.modular.yingbao.model.params.SysSellLogParam;
import cn.stylefeng.guns.modular.yingbao.service.SysSellLogService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 挂售日志控制器
 *
 * @author jj
 * @Date 2019-12-11 14:59:29
 */
@Controller
@RequestMapping("/sysSellLog")
public class SysSellLogController extends BaseController {

    private String PREFIX = "/sysSellLog";

    @Autowired
    private SysSellLogService sysSellLogService;

    /**
     * 跳转到主页面
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/sysSellLog.html";
    }

    /**
     * 新增页面
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/sysSellLog_add.html";
    }

    /**
     * 编辑页面
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/sysSellLog_edit.html";
    }

    /**
     * 新增接口
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(SysSellLogParam sysSellLogParam) {
        this.sysSellLogService.add(sysSellLogParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(SysSellLogParam sysSellLogParam) {
        this.sysSellLogService.update(sysSellLogParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(SysSellLogParam sysSellLogParam) {
        this.sysSellLogService.delete(sysSellLogParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author jj
     * @Date 2019-12-11
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(SysSellLogParam sysSellLogParam) {
        SysSellLog detail = this.sysSellLogService.getById(sysSellLogParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author jj
     * @Date 2019-12-11
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(SysSellLogParam sysSellLogParam) {
        return this.sysSellLogService.findPageBySpec(sysSellLogParam);
    }

}


